package com.link2room.optimus.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

/**
 * 价格全局表
 * Created by sss on 2016/8/25.
 */
@Entity
@Table(name = "price_static", catalog = "")
@DynamicInsert
public class PriceStatic  extends BaseEntity {
    public enum PriceStatic_{
        rmtype,priceCode,price
    }

    /**
     * 房型代码
     */
    private String rmtype;
    /**
     * 基价代码
     */
    private String priceCode;
    /**
     * 卖价
     */
    private BigDecimal price;

    @Basic
    @Column(name = "rmtype", nullable = false, length = 32)
    public String getRmtype() {
        return rmtype;
    }

    public void setRmtype(String rmtype) {
        this.rmtype = rmtype;
    }

    @Basic
    @Column(name = "price_code", nullable = false, length = 32)
    public String getPriceCode() {
        return priceCode;
    }

    public void setPriceCode(String priceCode) {
        this.priceCode = priceCode;
    }

    @Basic
    @Column(name = "price", nullable = false, precision = 2)
    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PriceStatic that = (PriceStatic) o;

        if (rmtype != null ? !rmtype.equals(that.rmtype) : that.rmtype != null) return false;
        if (priceCode != null ? !priceCode.equals(that.priceCode) : that.priceCode != null) return false;
        if (price != null ? !price.equals(that.price) : that.price != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = rmtype != null ? rmtype.hashCode() : 0;
        result = 31 * result + (priceCode != null ? priceCode.hashCode() : 0);
        result = 31 * result + (price != null ? price.hashCode() : 0);
        return result;
    }
}
